#!/usr/bin/env python3
# -*- coding:utf-8 -*-


def clac_sum(*args):
    ax = 0
    for n in args:
        ax += n
    return ax


def lazy_sum(*args):
    def sum():
        ax = 0
        for n in args:
            ax += n
        return ax
    return sum


f = lazy_sum(1, 2, 3, 4, 5)    # f 就是sum
print(f)
print(f())


def count():
    fs = []
    for i in range(1, 4):
        def f():
            return i*i
        fs.append(f)
    return fs


f = count()
f1, f2, f3 = count()
print(f1, f2, f3)
print(f1())
print(f2())
print(f3())


def count1():
    def f(j):
        def g():
            return j*j
        return g
    fs = []
    for i in range(1, 4):
        fs.append(f(i))
    return fs


f = count1()
f1, f2, f3 = f
print(f1, f2, f3)
print(f1())
print(f2())
print(f3())
